package com.zhy;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Student implements Comparable<Student>{
    private String name;
    private int age;

    @Override
    public int compareTo(Student o) {
        // 按照学生年龄正序排序（当前学生年龄this-被比较学生年龄o）
        return this.age-o.getAge();
    }
}
